#FROM vitzy/chineseocr_lite:latest
#RUN git clone https://gitee.com/mirrors/chineseocr_lite.git 
#WORKDIR /chineseocr_lite
#RUN pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
#RUN git checkout master
#RUN pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt

#EXPOSE 5000
#EXPOSE 8000

#CMD python3 flask_app.py

# 基于官方nginx镜像
FROM registry2-qingdao.cosmoplat.com/61_cosmoplat-oa/nginx:1.21.0
 
# 安装编译nginx模块所需的依赖
RUN apt-get update && apt-get install -y \
    build-essential \
    libpcre3-dev \
    zlib1g-dev \
    libssl-dev \
    libtool \
    autoconf \
    automake \
    make
 
# 下载并编译ngx_http_echo_module模块
RUN git clone https://github.com/openresty/echo-nginx-module.git /tmp/echo-nginx-module \
    && adduser --disabled-password --gecos "" nginx \
    && export NGX_PATH=/usr/local/nginx \
    && cd /tmp/echo-nginx-module \
    && nginx_version=$(grep "HTTP_MODULES" $NGX_PATH/auto/cc/nginx.conf | sed -e 's/.*"\(.*\)".*/\1/') \
    && echo "Building echo-nginx-module for $nginx_version" \
    && cd /tmp \
    && wget "http://nginx.org/download/nginx-$nginx_version.tar.gz" \
    && tar zxf "nginx-$nginx_version.tar.gz" \
    && cd "nginx-$nginx_version" \
    && ./configure --add-module=/tmp/echo-nginx-module --prefix=/usr/local/nginx --without-http_autoindex_module --user=nginx --group=nginx \
    && make -j$(nproc) \
    && make install
 
# 清理编译环境
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/local/nginx/html/*
 
# 复制nginx配置文件
COPY nginx.conf /usr/local/nginx/conf/nginx.conf
 
# 暴露80端口
EXPOSE 80
 
# 启动nginx
CMD ["nginx", "-g", "daemon off;"]